﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
%>
	<card title="物品管理"><p align="left">
<%
	dim rs,sql,page,i,id,rs1,sql1,j


    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
        id=Request.QueryString("id")
	if id="" then id=1
	if not isnumeric(id) then id=1
	id=clng(id)
if Request.QueryString("act")=1 then
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select top 1 *  FROM qingtian_chuwu where id="&id&""
		rs.open sql,conn,1,3
		if not (rs.eof and rs.bof) then
		rs.delete()
		end if
		rs.Close
		Set rs = Nothing
elseif Request.QueryString("act")=2 then 
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select *  FROM qingtian_chuwu where bid="&id&""
		rs.open sql,conn,1,3
		if not (rs.eof and rs.bof) then
                For i=1 to rs.RecordCount
		rs.delete()
	 	Rs.MoveNext
	  	Next
		end if
		rs.Close
		Set rs = Nothing
end if



	Set Rs = Server.CreateObject("Adodb.Recordset")
        Sql = "SELECT * from qingtian_user order by id desc"
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof)  then
				Rs.PageSize = 10	'一页N条记录
				IF Not IsEmpty(Page) Then
					IF Not IsNumeric(Page) Then		'判断Page是否为数字
						Page=1
					Else
						Page=Cint(Page)		'转换成短整形Integer
					End IF
					IF Page > Rs.PageCount Then
						Rs.AbsolutePage = Rs.PageCount	'设置当前显示页等于最后一页
					ElseIF Page <= 0 Then
						Rs.AbsolutePage = 1		'设置当前页等于第一页
					Else
						Rs.AbsolutePage = Page	'如果大于零,显示当前页等于接收的页数
					End IF
				Else
					Rs.AbsolutePage = 1
				End IF
				Page = Rs.AbsolutePage


		For i=1 to  Rs.PageSize
		If Rs.Eof Then
			exit For
		End If
			%><%=qingtian.utf8(rs("name"))%>(ID:<%=rs("id")%>)的物品[<a href="addchuwu.asp?page=<%=page%>&amp;id=<%=rs("id")%>&amp;sid=<%=sid%>">赠送</a>][<a href="chuwu.asp?act=2&amp;page=<%=page%>&amp;id=<%=rs("id")%>&amp;sid=<%=sid%>">清空</a>]<br/>(
<%
	Set rs1 = Server.CreateObject("Adodb.Recordset")
        sql1 = "select a.id,a.page,b.name from qingtian_chuwu a,qingtian_shangpin b where a.nid=b.nid and a.bid="&rs("id")&" order by a.id desc"
		rs1.Open sql1,conn,1,1
		if not (rs1.bof and rs1.eof)  then
		For j=1 to rs1.RecordCount
		If rs1.Eof Then
			exit For
		End If
                Response.Write(""&i&":"&rs1("name")&"/"&rs1("page")&"个<a href='chuwu.asp?page="&page&"&amp;act=1&amp;id="&rs1("id")&"&amp;sid=" & sid & "'>删</a>.")
	 	rs1.MoveNext
	  	Next
                else
                Response.Write("暂无物品") 
                end if
		rs1.close
	        set rs1=nothing 
%>)<br/>------------------<br/>
<%

	 	Rs.MoveNext
	  	Next

       
    		'分页
    		If Page < rs.PageCount Then
    		    Response.Write("<a href='chuwu.asp?page=" & Page + 1 & "&amp;sid=" & sid & "'>下一页</a>")
    		End If
       
    		If Page > 1 And Page < rs.PageCount Then
    		    Response.Write("|")
    		End If
        
    		If Page > 1 Then
    		    Response.Write("<a href='chuwu.asp?page=" & Page - 1 & "&amp;sid=" & sid & "'>上一页</a><br/>")
    		Elseif rs.PageCount >1 then
    		    Response.Write("<br/>")
    		End If
            
    		Randomize()
    
    		If rs.PageCount > 2 Then
    		    Response.Write("<input name='Page' format='*N' size='5' maxlength='5'/>")
    		    Response.Write("<anchor>跳页")
    		    Response.Write("<go href='chuwu.asp?run=" & Int((9999) * Rnd() + 1) & "&amp;sid=" & sid & "' method='post'>")
    		    Response.Write("<postfield name='Page' value='$(Page:n)' />")
    		    Response.Write("</go></anchor><br/>")
    		End If
     		    Response.Write("[第"&Page&"/总"&rs.PageCount&"页/"&rs.RecordCount&"条]<br/>")

		end if
		Rs.close

			
	set rs=nothing
   		Response.Write("<a href='index.asp?sid=" & sid & "'>管理首页</a><br/>")
end Function
%>
